package org.spring.learn.demo.annotation.configures.lifecyle;

import org.springframework.context.annotation.*;

@Configuration
//@ComponentScan("org.spring.learn.project.entity")
@ComponentScans({
        @ComponentScan("org.spring.learn.project.entity"),
        @ComponentScan("org.spring.learn.demo.annotation.configures.lifecyle")})
public class MyConfig {
    /**
     * 对Bean生命周期的控制
     * 1、配置@Bean的参数
     * 2、分别实现InitializingBean和 DisposableBean接口
     * 3、使用@PostConstruct和@preDestroy注解
     * 4、自己写一个类，实现BeanPostProcessor接口
     * @return
     */
//    @Lazy
//    @Bean(initMethod = "addOil",destroyMethod = "close")
//    public Car car(){
//        System.out.println("将对象添加到Ioc容器中");
//        return new Car();
//    }

}
